#! /bin/bash
echo " "
echo "Check current git branch"
current_branch=$(git rev-parse --abbrev-ref HEAD)
if [["$current_branch"==""]]; then
  echo "Please run the script in git dir."
  exit 1
fi
echo "Update branch: $current_branch"
echo " "
echo "************************************************************************"
echo "*** connect zhongkan                                  ***"
echo "************************************************************************"
echo " "
ssh zhongkan_www -t "
echo '====== 1 cd to project folder                                     ======';
cd "/www/wwwroot/duolupian.mafutech.com.cn/duolupian-vue";
pwd;
echo ' '
echo '====== 2. local git info review                                   ======';
git branch && git log -1 --stat && git checkout .;
echo ' '
echo '====== 3. run git pull                                            ======';
pwd;
git pull;
echo ' '
echo '====== 4. updated git info review                                  ======';
git log -1;
echo "
echo '*** pull completed ***'
